<%@ page import="com.walkingfiles.registry.Transfer" %>
<%@ page import="com.walkingfiles.registry.Document" %>
<%@ page import="com.walkingfiles.registry.TransferDocument" %>

<div class="fieldcontain ${hasErrors(bean: transferInstance, field: 'sourceArea', 'error')} required">
	<label for="sourceArea">
		<g:message code="transfer.sourceArea.label" default="Source" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="sourceArea" value="${transferInstance?.sourceArea?.name}" readonly="readonly" />
</div>

<div class="fieldcontain ${hasErrors(bean: transferInstance, field: 'destinationArea', 'error')} required">
	<label for="destinationArea">
		<g:message code="transfer.destinationArea.label" default="Destination" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="destinationArea" value="${transferInstance?.destinationArea?.name}" readonly="readonly" />
</div>

<div class="fieldcontain ${hasErrors(bean: transferInstance, field: 'subject', 'error')} required">
	<label for="subject">
		<g:message code="transfer.subject.label" default="Subject" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="subject" value="${transferInstance?.subject?.name}" readonly="readonly" />
</div>

<g:if test="${transferInstance?.sendComment?.comment}">
<div class="fieldcontain ${hasErrors(bean: transferInstance, field: 'sendComment.comment', 'error')} ">
	<label for="comment">
		<g:message code="transfer.sendComment.label" default="Comment" />
		
	</label>
	<g:textArea name="sendComment.comment" cols="40" rows="5" value="${transferInstance?.sendComment?.comment}" readonly="readonly" />
</div>
</g:if>

<%--
<div class="fieldcontain ${hasErrors(bean: transferInstance, field: 'transferDocuments', 'error')} ">
	<label for="transferDocuments">
		<g:message code="transfer.transferDocuments.label" default="Transfer Documents" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${transferInstance?.transferDocuments?}" var="t">
    <li><g:link controller="transferDocument" action="show" id="${t.id}">${t?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="transferDocument" action="create" params="['transfer.id': transferInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'transferDocument.label', default: 'TransferDocument')])}</g:link>
</li>
</ul>

</div>
--%>

<div class="fieldcontain ${hasErrors(bean: transferInstance, field: 'transferDocuments', 'error')} ">
	<label for="transferDocuments">
		<g:message code="transfer.transferDocuments.label" default="Documents" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${TransferDocument.findAllByTransfer(transferInstance)}" var="transferDocument">
	<li class="add">
	<label for="documentId" style="min-width:120px">
		${transferDocument.document.number}
	</label>
	<g:select name="transfer.receiveOption.${transferDocument.id}" from="${['accept', 'reject']}" valueMessagePrefix="transfer.receiveOption" noSelection="['':'Select...']" value="${receiveOption ? receiveOption[transferDocument.id.toString()] : null}" />
	</li>
</g:each>
</ul>

</div>

<div class="fieldcontain ${hasErrors(bean: transferInstance, field: 'receptionComment.comment', 'error')} ">
	<label for="comment">
		<g:message code="transfer.receptionComment.label" default="Comentario de Recepción" />
		
	</label>
	<g:textArea name="receptionComment.comment" cols="40" rows="5" value="${transferInstance?.receptionComment?.comment}" />
</div>

